<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
     <input type="text" v-model="msg">
     <my-com @subfun="receive"></my-com>
    </div>
    <template id="temp">
<div>
    <h1>{{msg}}</h1>
    <input type="button" value="点击回调" @click="send">
</div>
    </template>
</body>
<script>
    Vue.component("myCom",{
        template:"#temp",
        props:[],
        data(){
            return{
                msg:"这是子组件的信息"
            }
        },
      methods:{
          send(){
              this.$emit("subfun",this.msg)
          }
      }
    })
 var vm=new Vue({
     el:"#app",
     data:{
        msg:"父组件"
     },
     methods:{
     receive(arg){
         console.log(arg);
         this.msg=arg
     }
     }
 })
</script>
</html>